SVM patch to fix problem with instruction decode.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 22 Mar 2006 09:35:35 +0000 (10:35 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 22 Mar 2006 09:35:35 +0000 (10:35 +0100)
Signed-off-by: Tom Woller <thomas.woller@amd.com>
xen/arch/x86/hvm/svm/svm.c

index 24d0e986e6dd66d82661f0a85de1116102a31f7e..d3fa01177315f3cdee2e4bc342694bc24b10d8ab 100644 (file)
@@ -1243,20 +1243,19 @@ static void svm_io_instruction(struct vcpu *v, struct cpu_user_regs *regs)
                 "svm_io_instruction: port 0x%lx real %d, eip=%lx:%lx, "
                 "exit_qualification = %lx",
                 (unsigned long) port, real, cs, eip, (unsigned long)info.bytes);
-
-    /* 
-     * On SVM, the RIP of the intruction following the IN/OUT is saved in
-     * ExitInfo2
-     */
-    vmcb->rip = vmcb->exitinfo2;
-
     /* string instruction */
     if (info.fields.str)
     { 
         unsigned long addr, count = 1;
         int sign = regs->eflags & EF_DF ? -1 : 1;
 
+        /* Need the original rip, here. */
         addr = svm_get_io_address(vmcb, regs, dir, real);
+        /* 
+         * On SVM, the RIP of the intruction following the IN/OUT is saved in
+         * ExitInfo2
+         */
+        vmcb->rip = vmcb->exitinfo2;
 
         /* "rep" prefix */
         if (info.fields.rep) 
@@ -1295,6 +1294,12 @@ static void svm_io_instruction(struct vcpu *v, struct cpu_user_regs *regs)
     } 
     else 
     {
+        /* 
+         * On SVM, the RIP of the intruction following the IN/OUT is saved in
+         * ExitInfo2
+         */
+        vmcb->rip = vmcb->exitinfo2;
+
         if (port == 0xe9 && dir == IOREQ_WRITE && size == 1) 
             hvm_print_line(v, regs->eax); /* guest debug output */